﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace XProject.DataVisit.Model.Doc
{
    public class DocumentInfo:IProjectModel
    {
        public virtual Guid PID { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public virtual string DocName { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public virtual double DocPrice { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public virtual string DocCustom { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public virtual bool IsGoods { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public virtual double GoodsCount { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public virtual string GoodsName { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public virtual string Remark { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public virtual string MoreInfo { get; set; }
        /// <summary>
        /// 发布人
        /// </summary>
        public virtual Guid UserID { get; set; }
        /// <summary>
        /// 申请单状态0表示没有进入流程，1表示流程进行中，2表示流程结束
        /// </summary>
        public virtual int DocState { get; set; }

        public virtual string DState { get {
            string t = "未知";
            switch (DocState)
            {
                case 0: { t = "未审核"; break; }
                case 1: { t = "正在审核"; break; }
                case 2: { t = "审核成功"; break; }
            }
            return t;
        } }

        public virtual DateTime LastUpdate { get; set; }
        /// <summary>
        /// 操作日期
        /// </summary>
        public virtual string NTime { get {
            return LastUpdate.ToString("yyyy-MM-dd");
        } }

        #region 重写Hash和Equals
        public override int GetHashCode()
        {
            return PID.GetHashCode();
        }

        public override bool Equals(object obj)
        {
            var temp = obj as DocumentInfo;
            if (temp == null) return false;
            return temp.PID == this.PID;
        }
        #endregion
    }
}
